﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Implementation;
using interfaces;
using System.Drawing;
using System.Windows;

namespace civilizationWPF
{
    class FabriqueTexture
    {
        public ImageBrush plaineBrush;
        public ImageBrush desertBrush;
        public ImageBrush montBrush;
        public ImageBrush villeBrush;
        public ImageBrush ferBrush;
        public ImageBrush fruitBrush;

        public FabriqueTexture()
        {
            initialiseBrush();
        }

        /**
        * \fn initialiseBrush()
        * \brief initialise les brush pour l'affichage de la map
        */
        private void initialiseBrush()
        {
            Bitmap img = civilizationWPF.Properties.Resources.plaine;
            var bmp = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(img.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            plaineBrush = new ImageBrush(bmp);

            img = civilizationWPF.Properties.Resources.desert;
            bmp = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(img.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            desertBrush = new ImageBrush(bmp);

            img = civilizationWPF.Properties.Resources.montagne;
            bmp = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(img.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            montBrush = new ImageBrush(bmp);

            img = civilizationWPF.Properties.Resources.ville;
            bmp = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(img.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            villeBrush = new ImageBrush(bmp);

            img = civilizationWPF.Properties.Resources.fer;
            bmp = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(img.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            ferBrush = new ImageBrush(bmp);

            img = civilizationWPF.Properties.Resources.fruit;
            bmp = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(img.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            fruitBrush = new ImageBrush(bmp);
        }
    }
}
